\hypertarget{communicator_8h}{
\section{communicator.h File Reference}
\label{communicator_8h}\index{communicator.h@{communicator.h}}
}
Function prototypes and header file for \hyperlink{communicator_8c}{communicator.c}.  


{\tt \#include \char`\"{}config.h\char`\"{}}\par
{\tt \#include \char`\"{}dispatcher.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{communicator_8h_55bdb7a1f10c10fb2d1caeec885dcb61}{BUFFER\_\-START}~0
\item 
\#define \hyperlink{communicator_8h_327405022a51675553ea06115552cfd8}{BUFFER\_\-AWAITING\_\-LENGTH}~-1
\item 
\#define \hyperlink{communicator_8h_9e900c02895cdebd0c3f888af072da36}{BUFFER\_\-PARKED}~-2
\item 
\#define \hyperlink{communicator_8h_4292387367d272a89bfe9be891b6c9cd}{INVALID\_\-LENGTH}~-3
\item 
\#define \hyperlink{communicator_8h_b234d1358562b66925fb7223c087556b}{MAX\_\-MESSAGE\_\-LENGTH}~255
\item 
\#define \hyperlink{communicator_8h_901cd5e514daac1342f23624e25600d1}{KNOCK}~0xFF
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{communicator_8h_5f81facb36f7b18c987fd9a735bef1e2}{init\_\-communicator} ()
\item 
void \hyperlink{communicator_8h_4e6ba7a57d22958d993db85dbc0c8539}{send\_\-command} (uint8\_\-t device, uint8\_\-t id, uint8\_\-t command, uint8\_\-t $\ast$data, uint8\_\-t data\_\-length)
\item 
void \hyperlink{communicator_8h_9af3047f6b1c4588ffa9ed98304e26e4}{reset\_\-transmission\_\-record} ()
\item 
uint8\_\-t \hyperlink{communicator_8h_97a5c39315f6153fafcc95ef4748a230}{add\_\-byte\_\-to\_\-transmission\_\-record} (uint8\_\-t byte)
\end{CompactItemize}


\subsection{Detailed Description}
Function prototypes and header file for \hyperlink{communicator_8c}{communicator.c}. 

\begin{Desc}
\item[Author:]Peter Kalauskas \end{Desc}
\begin{Desc}
\item[Date:]Jan 23, 2009 \end{Desc}
\begin{Desc}
\item[Version:]1 \end{Desc}


\subsection{Define Documentation}
\hypertarget{communicator_8h_327405022a51675553ea06115552cfd8}{
\index{communicator.h@{communicator.h}!BUFFER\_\-AWAITING\_\-LENGTH@{BUFFER\_\-AWAITING\_\-LENGTH}}
\index{BUFFER\_\-AWAITING\_\-LENGTH@{BUFFER\_\-AWAITING\_\-LENGTH}!communicator.h@{communicator.h}}
\subsubsection[{BUFFER\_\-AWAITING\_\-LENGTH}]{\setlength{\rightskip}{0pt plus 5cm}\#define BUFFER\_\-AWAITING\_\-LENGTH~-1}}
\label{communicator_8h_327405022a51675553ea06115552cfd8}


Value of buffer\_\-index when it is expecting a length byte. \hypertarget{communicator_8h_9e900c02895cdebd0c3f888af072da36}{
\index{communicator.h@{communicator.h}!BUFFER\_\-PARKED@{BUFFER\_\-PARKED}}
\index{BUFFER\_\-PARKED@{BUFFER\_\-PARKED}!communicator.h@{communicator.h}}
\subsubsection[{BUFFER\_\-PARKED}]{\setlength{\rightskip}{0pt plus 5cm}\#define BUFFER\_\-PARKED~-2}}
\label{communicator_8h_9e900c02895cdebd0c3f888af072da36}


Value of buffer\_\-index when no message is being received. \hypertarget{communicator_8h_55bdb7a1f10c10fb2d1caeec885dcb61}{
\index{communicator.h@{communicator.h}!BUFFER\_\-START@{BUFFER\_\-START}}
\index{BUFFER\_\-START@{BUFFER\_\-START}!communicator.h@{communicator.h}}
\subsubsection[{BUFFER\_\-START}]{\setlength{\rightskip}{0pt plus 5cm}\#define BUFFER\_\-START~0}}
\label{communicator_8h_55bdb7a1f10c10fb2d1caeec885dcb61}


The first index in the buffer. \hypertarget{communicator_8h_4292387367d272a89bfe9be891b6c9cd}{
\index{communicator.h@{communicator.h}!INVALID\_\-LENGTH@{INVALID\_\-LENGTH}}
\index{INVALID\_\-LENGTH@{INVALID\_\-LENGTH}!communicator.h@{communicator.h}}
\subsubsection[{INVALID\_\-LENGTH}]{\setlength{\rightskip}{0pt plus 5cm}\#define INVALID\_\-LENGTH~-3}}
\label{communicator_8h_4292387367d272a89bfe9be891b6c9cd}


Value of transmission\_\-length when no length has been received yet. \hypertarget{communicator_8h_901cd5e514daac1342f23624e25600d1}{
\index{communicator.h@{communicator.h}!KNOCK@{KNOCK}}
\index{KNOCK@{KNOCK}!communicator.h@{communicator.h}}
\subsubsection[{KNOCK}]{\setlength{\rightskip}{0pt plus 5cm}\#define KNOCK~0xFF}}
\label{communicator_8h_901cd5e514daac1342f23624e25600d1}


The byte to be used at the start of each transmission. \hypertarget{communicator_8h_b234d1358562b66925fb7223c087556b}{
\index{communicator.h@{communicator.h}!MAX\_\-MESSAGE\_\-LENGTH@{MAX\_\-MESSAGE\_\-LENGTH}}
\index{MAX\_\-MESSAGE\_\-LENGTH@{MAX\_\-MESSAGE\_\-LENGTH}!communicator.h@{communicator.h}}
\subsubsection[{MAX\_\-MESSAGE\_\-LENGTH}]{\setlength{\rightskip}{0pt plus 5cm}\#define MAX\_\-MESSAGE\_\-LENGTH~255}}
\label{communicator_8h_b234d1358562b66925fb7223c087556b}


The length transmission of the transmission buffer. 

\subsection{Function Documentation}
\hypertarget{communicator_8h_97a5c39315f6153fafcc95ef4748a230}{
\index{communicator.h@{communicator.h}!add\_\-byte\_\-to\_\-transmission\_\-record@{add\_\-byte\_\-to\_\-transmission\_\-record}}
\index{add\_\-byte\_\-to\_\-transmission\_\-record@{add\_\-byte\_\-to\_\-transmission\_\-record}!communicator.h@{communicator.h}}
\subsubsection[{add\_\-byte\_\-to\_\-transmission\_\-record}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t add\_\-byte\_\-to\_\-transmission\_\-record (uint8\_\-t {\em byte})}}
\label{communicator_8h_97a5c39315f6153fafcc95ef4748a230}


Adds a byte to the transmission buffer. The byte's role in the transmission will be determined by the function. The byte may be invalidly placed (ie. it may not be the starting byte where a starting should be), a length byte (which is not added to the buffer), or it may be added to the buffer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em byte}]The byte to be added to the transmission. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]uint8\_\-t 0 if this is the end of the transmission, 1 otherwise \end{Desc}
\begin{Desc}
\item[Author:]Peter Kalauskas \end{Desc}
\hypertarget{communicator_8h_5f81facb36f7b18c987fd9a735bef1e2}{
\index{communicator.h@{communicator.h}!init\_\-communicator@{init\_\-communicator}}
\index{init\_\-communicator@{init\_\-communicator}!communicator.h@{communicator.h}}
\subsubsection[{init\_\-communicator}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-communicator ()}}
\label{communicator_8h_5f81facb36f7b18c987fd9a735bef1e2}


Initializes the communicator.

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}
\hypertarget{communicator_8h_9af3047f6b1c4588ffa9ed98304e26e4}{
\index{communicator.h@{communicator.h}!reset\_\-transmission\_\-record@{reset\_\-transmission\_\-record}}
\index{reset\_\-transmission\_\-record@{reset\_\-transmission\_\-record}!communicator.h@{communicator.h}}
\subsubsection[{reset\_\-transmission\_\-record}]{\setlength{\rightskip}{0pt plus 5cm}void reset\_\-transmission\_\-record ()}}
\label{communicator_8h_9af3047f6b1c4588ffa9ed98304e26e4}


Clears the buffer and resets the index to 0.

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}
\hypertarget{communicator_8h_4e6ba7a57d22958d993db85dbc0c8539}{
\index{communicator.h@{communicator.h}!send\_\-command@{send\_\-command}}
\index{send\_\-command@{send\_\-command}!communicator.h@{communicator.h}}
\subsubsection[{send\_\-command}]{\setlength{\rightskip}{0pt plus 5cm}void send\_\-command (uint8\_\-t {\em device}, \/  uint8\_\-t {\em id}, \/  uint8\_\-t {\em command}, \/  uint8\_\-t $\ast$ {\em data}, \/  uint8\_\-t {\em data\_\-length})}}
\label{communicator_8h_4e6ba7a57d22958d993db85dbc0c8539}


Sends a function and data to the given device on the client. The client will interpret this as a Message object and pass it along to the correct device.

\begin{Desc}
\item[Author:]Robert Breznak, Peter Kalauskas \end{Desc}
